<?php


namespace app\controller;
use app\model\AdminUser;
use think\facade\Db;

class Demo
{
 public function index(){
    // $result = Db::table("mall_admin_user")->where("id",0)->find();
     //通过容器的方式获取
     //$result =  app("db")->table("mall_admin_user")->where("id",0)->find();
     $result = Db::table("mall_admin_user")
         ->order("id","desc")
//         ->limit("1","2")
         ->select();
     dump( $result);
 }
 public function index2(){
/*
 * sql语句排查方式
 */
    // 打印sql的方式查询

    $result = Db::table("mall_admin_user")->where("id",0)->fetchSql()->find();
    dump($result);
    //输出sql的方式
     $res = Db::table("mall_admin_user")->where("id",0)->find();
     echo Db::getLastSql();
     exit();
 }
 public function model1(){
     $result = AdminUser::find(1);
     dump($result->toArray());
 }
}